import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import * as gc from 'src/app/global/const';
import { Observable } from 'rxjs';
import { JsonResult } from 'src/app/global/model';

@Injectable({
  providedIn: 'root'
})
export class SysuserService {

  urlPre = '/sysUser';

  url = {
    'selectByUserId':gc.BACKEND_SERVER_ROOT + this.urlPre + '/8id',
    'selectUserPermissions':gc.BACKEND_SERVER_ROOT + this.urlPre + '/selectUserPermissions'
  }

  constructor(
    private http:HttpClient
  ) { }


  selectByUserId(userId:string):Observable<JsonResult>{
    const url = this.url.selectByUserId + '/' + userId;
    return this.http.get<JsonResult>(url);
  }

  selectUserPermissions(userId:string):Observable<JsonResult>{
    const url = this.url.selectUserPermissions + '/' + userId;
    return this.http.get<JsonResult>(url);
  }

}
